package com.fenghongzhang.day005;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

public class FToActivity extends AppCompatActivity implements SendFragment.MyLintener {
    private TextView text2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_f_to);

        text2 = (TextView) findViewById(R.id.text2);

        FragmentManager supportFragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
        SendFragment sendFragment = new SendFragment();
        DownFragment downFragment = new DownFragment();
        //把老的替换掉
        fragmentTransaction.add(R.id.ll,sendFragment);
        fragmentTransaction.add(R.id.ll,downFragment,"down");
        fragmentTransaction.commit();
    }


    @Override
    public void eat(String s) {
        text2.setText(s);
    }
}
